*Table 3*


putexcel set "Results\tab_B3\robustness_table_eq_no_3d", replace

putexcel B1 = "N (1,000s)"
putexcel B2 = "1980"
putexcel C2 = "2018"

putexcel D1 = "Sorting"
putexcel D2 = "1980"
putexcel E2 = "2018"
putexcel F2 = "Change"

putexcel G1 = "Gini, data"
putexcel G2 = "1980"
putexcel H2 = "2018"

putexcel I1 = "Gini (i)"
putexcel I2 = "2018"

putexcel J1 = "D Gini (i)/D Gini, data"



*No 3-digit codes

putexcel A4 = "No 3-digit codes"

clear
use "Results\tab_B3\Scenario_13\Sorting\results_ambition"

gen temp=male_1_marr+male_2_marr+male_3_marr+male_4_marr+female_1_marr+female_2_marr+female_3_marr+female_4_marr+male_1_sing+male_2_sing+male_3_sing+male_4_sing+female_1_sing+female_2_sing+female_3_sing+female_4_sing

qui sum temp if aar==1980
sca temp2=r(mean)/1000

putexcel B4 = temp2

qui sum temp if aar==2018
sca temp2=r(mean)/1000

putexcel C4 = temp2

drop temp

gen temp=s_1_1*(0*male_1+(1-0)*female_1)+s_2_2*(0*male_2+(1-0)*female_2)+s_3_3*(0*male_3+(1-0)*female_3)+s_4_4*(0*male_4+(1-0)*female_4)

qui sum temp if aar==1980
sca temp2=r(mean)

putexcel D4 = temp2

qui sum temp if aar==2018
sca temp3=r(mean)

putexcel E4 = temp3

sca temp4=(temp3-temp2)/temp2

putexcel F4 = temp4

drop temp

clear
use "Results\tab_B3\Scenario_13\Decomposition\results_eq"

qui sum gini if aar==1980
sca temp2=r(mean)

putexcel G4 = temp2

qui sum gini if aar==2018
sca temp3=r(mean)

putexcel H4 = temp3

qui sum gini_cf_sort if aar==2018
sca temp4=r(mean)

putexcel I4 = temp4

sca temp5=(temp4-temp2)/(temp3-temp2)

putexcel J4 = temp5

